﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WpfApplication1.DBLayer;
//using WpfApplication1.DBStubs;
using WpfApplication1.LogicLayer;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Login.xaml
    /// </summary>
    public partial class Login : Page
    {
        public static int id;
        public Login()
        {
            InitializeComponent();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            BankTellerDB user = new BankTellerDB();
            BankTellerLogic UserLogin = new BankTellerLogic();
            try
            {
                bool valid = UserLogin.Login(nameTxt.Text, passwordTxt.Password);
                if (valid == true)
                {
                    id = Convert.ToInt32(Application.Current.Resources["UserLoginID"]);
                    //id= BankTellerLogic.UserLoginID;
                    chooseBank cb = new chooseBank();
                    this.NavigationService.Navigate(cb);
                    // MessageBox.Show("You entered sucssufuly");
                }
                else
                    MessageBox.Show("Invalid username or password");

            }
            catch
            {
                MessageBox.Show("Wrong username or password");
            }
        }
    }
}
